/**
 * Created with IntelliJ IDEA.
 * Description:字符串中的第一个唯一字符
 * User: wangxin
 * Date: 2024-09-14
 * Time: 21:25
 */
public class test1 {
    class Solution {
        public int firstUniqChar(String s) {
            int[] count  = new int[256];
            for(int i = 0;i < s.length();++i){
                count[s.charAt(i)]++;
            }
            for(int i = 0;i < s.length();++i){
                if(1 == count[s.charAt(i)]){
                    return i;
                }
            }
            return -1;
        }
    }

}
